<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="ProjectMgtSystem.Entities.*" %>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<link rel="stylesheet" type="text/css" href="css/ui.all.css">
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="js/ui.core.js"></script>
<script type="text/javascript" src="js/ui.datepicker.js"></script>

<script type="text/javascript">
    //define function to be execute
    //d on document ready
    $(function(){
        //define config object
        var pickerOpts = {
            
        };
        //create the date picker
        $("#date1").datepicker(pickerOpts);
    });
</script>
<script type="text/javascript">
    //define function to be execute
    //d on document ready
    $(function(){
        //define config object
        var pickerOpts = {
            
        };
        //create the date picker
        $("#date2").datepicker(pickerOpts);
    });
</script>
<script type="text/javascript">
    //define function to be executed on document ready
    $(function(){
        //create the date picker
        $("#date3").datepicker();
    });
</script>
<script type="text/javascript">
    //define function to be executed on document ready
    $(function(){
        //create the date picker
        $("#date4").datepicker();
    });
</script>
<script type="text/javascript">
    function confirm(){
        var x = $("#EN").val();
        if(x=="-1" || x==null){
            alert("No engineer has been chosen!");
            return false;
        }
        else
            return true;
    }
</script>
<jsp:include page="../../template/user_top.jsp"/>   

<!--our main content starts here--->
<table id="travel" width="50%">
    <caption>Your're watching ${requestScope.PROJECTID}, ${requestScope.TASKID}</caption>                

    <html:form action="/AssignmentAction">
        <thead>
            <tr>
                <th>Engineer ID</th>
                <th>First Name</th>
                <th>Last Name</th>
            </tr>
        </thead>
        <tfoot>
            <% java.util.ArrayList<Engineer> assEngineerList = (java.util.ArrayList<Engineer>) request.getAttribute("AssignEngineerList");
                for (Engineer en : assEngineerList) {%>
            <tr>
                <td><%=en.getEngineerID()%></td>
                <td><%=en.getFirstName()%></td>
                <td><%=en.getLastName()%></td>
                <td><html:submit property="method"><bean:message key="AssignmentAction.updateAssignEngineer"/></html:submit></td>
                <html:hidden property="projectid" value="${requestScope.PROJECTID}"/>
                <html:hidden property="taskid" value="${requestScope.TASKID}"/>
                <html:hidden property="taskid" value="${requestScope.USERID}"/>
                <html:hidden property="engineerid" value="<%=en.getEngineerID()%>"/>
            </tr>
            <% }%>
            <tr>
                <td>
                    <html:select property="engineerid1" styleId="EN"> 
                        <html:option value="-1">Choose a value</html:option>
                        <%
                            java.util.ArrayList<Engineer> eList = (java.util.ArrayList<Engineer>) request.getAttribute("ListEnNotAssigned");
                            if (eList.size() > 0) {
                                for (Engineer en : eList) {
                        %>                                                     }
                        <html:option value="<%= en.getEngineerID()%>"><%= en.getEngineerID()%> _ <%= en.getLastName()%> <%= en.getFirstName()%></html:option>
                        <%
                                }

                            } else
                                out.print("error");
                        %>                                                                                                        
                    </html:select> 
                </td>
                <td><html:submit property="method" onclick="return confirm()"><bean:message key="AssignmentAction.addAssignEngineer"/></html:submit></td>
            </tr>
        </tfoot>




    </html:form>
</table>



<div align="left" style="padding-left: 50px;">
    <table 
        style="border-collapse: collapse;
        margin-bottom: 15px;
        width: auto; left: auto;
        ">
        <html:form action="/AssignmentAction">
            <% java.util.ArrayList<Assignment> assInfoList = (java.util.ArrayList<Assignment>) request.getAttribute("AssignInfoList");

                for (Assignment ass : assInfoList) {%>


            <tr>
                <th style="text-align: left;">Planning Start Date</th>
                <td><html:text property="planStartDate" value="<%=ass.getPlanStartDate()%>" styleId="date1"/></td>
            </tr>

            <tr>
                <th style="text-align: left;">Planning End Date</th>
                <td><html:text property="planEndDate" value="<%=ass.getPlanEndDate()%>" styleId="date2"/></td>
            </tr>

            <tr>
                <th style="text-align: left;">Start Date</th>
                <td><html:text property="startDate" value="<%=ass.getStartDate()%>" styleId="date3"/></td>
            </tr>

            <tr>
                <th style="text-align: left;">End Date</th>
                <td><html:text property="endDate" value="<%=ass.getEndDate()%>" styleId="date4"/></td>
            </tr>

            <tr>
                <th style="text-align: left;">Complete Ratio</th>
                <td><html:text property="completeRatio" value="<%=ass.getCompleteRatio()%>"/></td>
            </tr>
            <tr>




                <td><html:submit property="method"><bean:message key="AssignmentAction.updateAssignInfo"/></html:submit></td>
                <html:hidden property="projectid" value="${requestScope.PROJECTID}"/>
                <html:hidden  property="userid" value="${requestScope.USERID}"/>
                <html:hidden property="taskid" value="<%=ass.getTaskid()%>"/>
                <td><html:submit property="method"><bean:message key="AssignmentAction.viewTaskByProj1"/></html:submit></td>
                
            </tr>
            <%     }
            %>




        </html:form>  
    </table>
</div>
   
<!--our main content ends here -->


<jsp:include page="../../template/user_bottom.jsp"/> 